import request from '@/utils/request'
// 查询设备模型视图面板下拉框选项列表
export const getComboListApi = (id) =>
  request.get(`/core/vom/model/design/page-panel/combo-items?classId=${id}`)

// 查询设备模型视图组件列表
export const getComponentListApi = (id) =>
  request.get(`/core/vom/model/design/page-component/list?classId=${id}`)

// 查询上级设备模型下拉框选项列表
export const getAncestorComboListApi = (id) =>
  request.get(
    `/core/vom/model/design/page-view/ancestor/combo-items?classId=${id}`
  )

// 查询所有下级模型视图列表
export const getDescendantListApi = (id) =>
  request.get(
    `/core/vom/model/design/page-view/descendant/list?componentId=${id}`
  )

// 同步设备模型视图
export const syncModelViewApi = (data) =>
  request.post('/core/vom/model/design/page-component/sync', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })
// 批量复制新增设备模型视图组件
export const copyModelViewApi = (data) =>
  request.post('/core/vom/model/design/page-component/copy', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })
// 上移设备模型视图组件
export const upModelViewApi = (id) =>
  request.post(
    `/core/vom/model/design/page-component/move-up?componentId=${id}`
  )

// 下移设备模型视图组件
export const downModelViewApi = (id) =>
  request.post(
    `/core/vom/model/design/page-component/move-down?componentId=${id}`
  )

// 删除设备模型视图组件
export const delModelViewApi = (id) =>
  request.post(
    `/core/vom/model/design/page-component/delete?componentId=${id}`
  )

// 查询事件子菜单列表
export const getEventMenuApi = () =>
  request.get('/core/dictionary/combo-item/list?dictType=VomActionType')

// 查询校验子菜单列表
export const getValidataMenuApi = () =>
  request.get('/core/dictionary/combo-item/list?dictType=VomValidatorType')

// 字典查询
export const getDictionaryApi = (dictType) =>
  request.get(`/core/dictionary/combo-item/list?dictType=${dictType}`)

// 上移视图组件事件动作
export const upViewActionApi = (id) =>
  request.post(`/core/vom/model/design/page-action/move-up?actionId=${id}`)

// 下移视图组件事件动作
export const downViewActionApi = (id) =>
  request.post(`/core/vom/model/design/page-action/move-down?actionId=${id}`)

// 删除视图组件事件动作
export const delViewActionApi = (id) =>
  request.post(`/core/vom/model/design/page-action/delete?actionId=${id}`)

// 删除视图组件校验
export const delViewvalidatorApi = (id) =>
  request.post(
    `/core/vom/model/design/page-validator/delete?validatorId=${id}`
  )

// 查询设备模型视图组件信息
export const getComponentDataApi = (id) =>
  request.get(`/core/vom/model/design/page-component?componentId=${id}`)

// 修改设备模型视图文本输入框组件
export const editViewTextApi = (data) =>
  request.post('/core/vom/model/design/page-component/text/put', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })

// 修改设备模型视图多行文本框组件
export const editViewTextareaApi = (data) =>
  request.post('/core/vom/model/design/page-component/textarea/put', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })

// 修改设备模型视图日期输入框组件
export const editViewDateApi = (data) =>
  request.post('/core/vom/model/design/page-component/date/put', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })

// 修改设备模型视图数值输入框组件
export const editViewNumberApi = (data) =>
  request.post('/core/vom/model/design/page-component/number/put', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })

// 修改设备模型视图代码下拉框组件
export const editViewCodeComboApi = (data) =>
  request.post('/core/vom/model/design/page-component/code-combo/put', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })

// 修改设备模型视图数据库下拉框组件
export const editViewDbComboApi = (data) =>
  request.post('/core/vom/model/design/page-component/db-combo/put', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })

// 修改设备模型视图无数据下拉框组件
export const editViewEmptyComboApi = (data) =>
  request.post('/core/vom/model/design/page-component/empty-combo/put', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })

// 分发同步设备模型视图组件
export const dispenseViewApi = (data) =>
  request.post('/core/vom/model/design/page-component/dispense', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })

// 查询视图组件事件动作列表
export const getComponentActionListApi = (id) =>
  request.get(`/core/vom/model/design/page-action/list?componentId=${id}`)

// 创建字典名称显示转换事件
export const addCodeConvertApi = (data) =>
  request.post('/core/vom/model/design/page-action/code-convert', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })

// 创建数据库查询显示转换事件
export const addDbConvertApi = (data) =>
  request.post('/core/vom/model/design/page-action/db-convert', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })

// 创建字典数据下拉框级联事件
export const addComboCodeFilterApi = (data) =>
  request.post('/core/vom/model/design/page-action/combo-code-filter', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })

// 创建字典数据下拉框级联事件
export const addComboDbFilterApi = (data) =>
  request.post('/core/vom/model/design/page-action/combo-db-filter', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })

// 创建自定义下拉框取值事件
export const addComboCustomFilterApi = (data) =>
  request.post('/core/vom/model/design/page-action/combo-custom-filter', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })

// 创建字典名称设值事件
export const addSetCodeNameApi = (data) =>
  request.post('/core/vom/model/design/page-action/set-code-name', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })

// 创建数据库查询设值事件
export const addSetDbValueApi = (data) =>
  request.post('/core/vom/model/design/page-action/set-db-value', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })

// 创建数据库查询设值事件
export const addSetScriptValueApi = (data) =>
  request.post('/core/vom/model/design/page-action/set-script-value', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })

// 创建组件禁用设置事件
export const addSetDisableStateApi = (data) =>
  request.post('/core/vom/model/design/page-action/set-disable-state', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })

// 创建组件禁用设置事件
export const addSetReadonlyStateApi = (data) =>
  request.post('/core/vom/model/design/page-action/set-readonly-state', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })

// 查询视图组件事件动作信息
export const getActionDataApi = (id) =>
  request.get(`/core/vom/model/design/page-action?actionId=${id}`)

// 修改字典名称显示转换事件
export const editCodeConvertApi = (data) =>
  request.post('/core/vom/model/design/page-action/code-convert/put', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })

// 修改数据库查询显示转换事件
export const editDbConvertApi = (data) =>
  request.post('/core/vom/model/design/page-action/db-convert/put', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })

// 修改字典数据下拉框级联事件
export const editComboCodeFilterApi = (data) =>
  request.post(
    '/core/vom/model/design/page-action/combo-code-filter/put',
    data,
    {
      headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    }
  )

// 修改字典数据下拉框级联事件
export const editComboDbFilterApi = (data) =>
  request.post('/core/vom/model/design/page-action/combo-db-filter/put', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })

// 修改自定义下拉框取值事件
export const editComboCustomFilterApi = (data) =>
  request.post(
    '/core/vom/model/design/page-action/combo-custom-filter/put',
    data,
    {
      headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    }
  )

// 修改字典名称设值事件
export const editSetCodeNameApi = (data) =>
  request.post('/core/vom/model/design/page-action/set-code-name/put', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })

// 修改数据库查询设值事件
export const editSetDbValueApi = (data) =>
  request.post('/core/vom/model/design/page-action/set-db-value/put', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })

// 修改数据库查询设值事件
export const editSetScriptValueApi = (data) =>
  request.post(
    '/core/vom/model/design/page-action/set-script-value/put',
    data,
    {
      headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    }
  )

// 修改组件禁用设置事件
export const editSetDisableStateApi = (data) =>
  request.post(
    '/core/vom/model/design/page-action/set-disable-state/put',
    data,
    {
      headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    }
  )

// 修改组件禁用设置事件
export const editSetReadonlyStateApi = (data) =>
  request.post(
    '/core/vom/model/design/page-action/set-readonly-state/put',
    data,
    {
      headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    }
  )

// 查询视图组件校验列表
export const getValidatorListApi = (id) =>
  request.get(`/core/vom/model/design/page-validator/list?componentId=${id}`)

// 创建视图组件常规校验信息
export const addGeneralValidatorApi = (data) =>
  request.post('/core/vom/model/design/page-validator/general', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })

// 创建视图组件自定义校验信息
export const addCustomValidatorApi = (data) =>
  request.post('/core/vom/model/design/page-validator/custom', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })

// 修改视图组件常规校验信息
export const editGeneralValidatorApi = (data) =>
  request.post('/core/vom/model/design/page-validator/general/put', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })

// 修改视图组件自定义校验信息
export const editCustomValidatorApi = (data) =>
  request.post('/core/vom/model/design/page-validator/custom/put', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })

// 查询视图组件校验信息
export const getValidatorDataApi = (id) =>
  request.get(`/core/vom/model/design/page-validator?validatorId=${id}`)

// 查询视图下拉框组件下拉框选项列表
export const getComboItemsListApi = (id) =>
  request.get(`/core/vom/model/design/page-component/combo-component/combo-items?componentId=${id}`)

// 查询视图组件下拉框选项列表
export const getComboItemsList2Api = (id) =>
  request.get(`/core/vom/model/design/page-component/combo-items?componentId=${id}`)

// 查询设备模型视图信息
export const getPageViewDataApi = (id) =>
  request.get(`/core/vom/model/design/page-view?classId=${id}`)